<div class="container-fluid">

    <app-page-title title="Knowledgebase" [breadcrumbItems]="breadCrumbItems"></app-page-title>

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title mb-4">Create Knowledgebase Item</h4>
                    <form class="needs-validation" (ngSubmit)="validSubmit()" [formGroup]="knowledgebaseForm">
                        <div class="form-group">
                            <label for="title">Title</label>
                            <input type="text" class="form-control" id="title"
                                formControlName="title" placeholder="Knowledgebase Title" onfocus="this.placeholder =''" onblur="this.placeholder = 'Knowledgebase Title'"
                                [ngClass]="{'is-invalid': submit && form.title.errors}">
                            <div *ngIf="submit && form.title.errors" class="invalid-feedback">
                                <span *ngIf="form.title.errors.required">Required!</span>
                            </div>
                        </div>     
                        <div class="form-group">
                            <label for="content">Description</label>
                            <textarea type="text" class="form-control" id="content"
                                formControlName="content" placeholder="Knowledgebase Description"
                                onfocus="this.placeholder = ''" onblur="this.placeholder = 'Knowledgebase Description'"
                                [ngClass]="{'is-invalid': submit && form.content.errors}" rows="20"></textarea>
                            <div *ngIf="submit && form.content.errors" class="invalid-feedback">
                                <span *ngIf="form.content.errors.required">Required!</span>
                            </div>
                        </div>   
                        <div class="text-right">
                            <button (click)="createKnowledgebaseItem()" class="btn btn-success mr-2"
                                type="button">Create</button>
                            <button [routerLink]="['/knowledgebase/view']" class="btn btn-danger"
                                type="button">Cancel</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>